<?php

require ("sharedResources.php");

$sid = '';
try {
    // We need a SID (session ID) in order to operate
	$sid = login ( 'admin', 'admin' );
	echo 'sid: ' . $sid . PHP_EOL;
	
	$options ['expression'] = 'national government'; // this is the full-text query
	$options ['expressionLanguage'] = 'en'; // this is the language of the query (en == english)
	$options ['language'] = 'en'; // this is the language of the documents we are looking for
	$options ['maxHits'] = 50; // Max number of results we want to retrieve	
	
	// Required but not checked
	$options ['type'] = 0; // 0 is full-text query
	$options ['userId'] = 0; // not used
	$options ['searchInSubPath'] = false;

	// New from 6.4
	$options ['depth'] = 0; // Folder depth
	
  // New from 6.5.2
  $options ['retrieveAliases'] = 0; // requested but not used
  $options ['caseSensitive'] = 0; // requested but not used	
	
	$searchParams = array ('sid' => $sid, 'options' => $options );
	
	$result = $searchClient->find ( $searchParams );
	print_r ( $result );
	
	echo PHP_EOL . 'estimated Hits Number: ' . $result->searchResult->estimatedHitsNumber;
	//unset ( $folderClient );
} catch ( SoapFault $e ) {
	print_r ( $e );
}

// Always we need to logout in order to release connection slot
logout ( $sid );
?> 
